﻿namespace NTLib.Pipe.Windows.Providers
{
    using Pipe.Providers;
    using System;
    using System.Collections.Generic;
    using System.IO.Pipes;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Descriptors;
    using System.Threading;
    using Core.Attributes;
    using Pipe.Descriptors;

    /// <summary>
    /// Pipe provider that create pipe using the windows <see cref="NamedPipeClientStream"/>
    /// </summary>
    /// <seealso cref="NTLib.Pipe.Providers.IPipeProvider" />
    [Guid(ProviderID)]
    public sealed class NamedPipeProvider : BasePipeProvider, IPipeProvider
    {
        #region Fields

        public const string ProviderID = "6B4863D9-BD02-48E7-A3F3-E3D57D46EBFB";

        private readonly Guid _id = Guid.NewGuid();

        #endregion

        #region Properties

        /// <summary>
        /// Gets the instance identifier.
        /// </summary>
        public override Guid Id
        {
            get { return this._id; }
        }

        #endregion

        #region Methods

        /// <summary>
        /// Determines whether this instance can managed target the specified target.
        /// </summary>
        /// <param name="desc">Target description used to define the target.</param>
        /// <param name="token"></param>
        /// <returns>
        /// <c>true</c> if the provider can managed the specific target.
        /// </returns>
        public override Task<bool> CanManagedTargetAsync(ITargetDescriptor desc, CancellationToken token = default(CancellationToken))
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Called to create the specific pipe source associate the target.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="type">The type of the pipe.</param>
        /// <param name="target">The target of the pipe.</param>
        /// <param name="token">The cancel token.</param>
        /// <returns>
        /// IPipeSource that could managed object transfert in both ways.
        /// </returns>
        /// <exception cref="System.NotImplementedException"></exception>
        protected override Task<IPipe<T>> OnCreateSourceAsync<T>(PipeType type, ITargetDescriptor target, CancellationToken token)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
